Skip to content

feat(sidebar): sort workspaces and pin them to the top - #272

Merged
andrebrait merged 2 commits into
ompweb-dev:mainfrom
andrebrait:feat/workspace-sort-and-pins
Oct 22, 2026
Merged

andrebrait merged 2 commits into
ompweb-dev:mainfrom
andrebrait:feat/workspace-sort-and-pins

Conversation

@andrebrait

Copy link
Copy Markdown
Collaborator

Closes #271.

Problem

Workspaces could only be ordered by hand (or by when they were added). There was no way to keep the workspaces you are working on at the top, either automatically by activity or by pinning them.

Changes

  • Sort button next to the workspace search: None (the existing manual order), Alphabetical (A→Z by the displayed name, case-insensitive, digits compared numerically) and Last updated (the workspace whose session got the newest message first; workspaces without sessions last). The choice is stored per browser (omp-web:project-sort in localStorage). The button is a menu trigger (aria-haspopup/aria-expanded). The menu opens on the checked option and returns focus to the button when it closes.
  • Pins, available only while a sort is active: a pin button to the left of each workspace's … button. Pinned workspaces stay at the top in their own manual order, unaffected by the sort. A newly pinned workspace goes to the end of the pinned group. While a sort is active, only pinned workspaces keep Move up, Move down and dragging; unpinned ones follow the sort. Under None, pins are ignored and the manual order applies unchanged.
  • pinOrder is stored in projects.json next to sortOrder. PATCH /api/projects accepts it (a number, or null to unpin), and a bad value returns invalid_pin_order. Pin and reorder writes are serialized, so a click based on a list that has not reloaded yet cannot undo the previous write.
  • Last message time: the session list's existing 32 KiB tail scan, which already finds the last message entry for the session status, now also returns that entry's timestamp as SessionInfo.lastMessageAt. "Last updated" uses it, falling back to the file mtime, so a rename or auto-name does not move a workspace to the top.
  • The ordering freeze that holds rows in place while a new session's file is pending now ends when the user changes the sort, pins or reorders, and frozen rows show fresh project data. Modes other than "Last updated" no longer re-sort on every session refresh.
  • en/ja/zh-CN strings, AGENTS.md and CHANGELOG (Unreleased).

Verification

  • Real browser (headless Chromium, isolated agent directory with four workspaces):
    • "Last updated" ordered workspaces by their last message, not by mtime. A session with the oldest message but the newest mtime ranked below newer ones.
    • Alphabetical and None ordered as described.
    • Pinning two workspaces put them on top in pin order, with aria-pressed set.
    • An unpinned row's … menu lacked Move up/down, while a pinned row had them.
    • The sort menu opened on the checked item and returned focus to the trigger after Enter and after Escape.
  • New tests:
    • lib/project-ordering.test.mjs: every mode with pins; the newest session per workspace wins; the last message time beats mtime; case-insensitive and numeric names; where a new pin goes.
    • lib/project-registry.test.mjs: pin and unpin round trip.
    • lib/session-reader.test.mjs: lastMessageAt is taken from the tail and is not moved by a later title_change.
  • npm test, npm run lint (no errors) and tsc --noEmit pass.
  • Not checked on a physical phone or tablet.

Add a sort menu beside the workspace search (None, Alphabetical, Last updated) and, while a sort is active, a pin toggle per workspace. Pinned workspaces lead in their own manual order (pinOrder in projects.json); unpinned ones follow the sort and lose Move up/down and drag. Last updated uses the last message time from the session tail scan (SessionInfo.lastMessageAt), falling back to the file mtime.
@andrebrait
andrebrait merged commit 71d9b16 into ompweb-dev:main Oct 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Workspace Reorder itself based on last usage and adding a Pin button to Pin a Workspace

1 participant